package com.gaogzhen.designPattern.guardedSuspension;

import lombok.extern.slf4j.Slf4j;

/**
 * 居民类
 */
@Slf4j(topic = "d.Resident")
public class Resident implements Runnable{
    private String identifier;

    public Resident(String identifier) {
        this.identifier = identifier;
    }

    @Override
    public void run() {
        // 收信
        GuardedDecouple letter = MailBoxes.getLetter(identifier);
        log.debug("等待收信");
        Object content = letter.get(5000);
        log.debug("居民房间编号：{}，信已收到，内容：{}", letter.getIdentifier(), content);
    }
}
